import BookMethods.BookMethods;
import User.AdminUser;
import User.NormalUser;
import User.AdminUser;
import User.User;
import book.BookList;

import java.util.Scanner;

public class BookSystemTest {

    public static User login() {
        Scanner scanner = new Scanner(System.in);

        System.out.print("输入用户姓名: ");
        String userName = scanner.nextLine();

        System.out.println("输入用户身份: 1为管理员用户, 2为普通用户 ");
        int identity = scanner.nextInt();

        if (identity == 1) {
            AdminUser adminUser = new AdminUser(userName);
            return adminUser;
        } else {
            NormalUser normalUser = new NormalUser(userName);
            return normalUser;
        }
    }
    public static void main(String[] args) {
        User user = login();

        boolean flag = true;

        BookList booklist = new BookList();

        while(flag) {
            int choice = user.menu();
            user.getMethods()[choice].method(booklist);
        }
    }
}
